//
//  PhotoViewController.m
//  freeLance
//
//  Created by Igor Karpenko on 4/16/13.
//  Copyright (c) 2013 Mozi Development. All rights reserved.
//

#import "PhotoViewController.h"

#define PADDING 20

@interface PhotoViewController ()

@end

@implementation PhotoViewController

-(id) initWithDataSource:(id <KTPhotoBrowserDataSource>)dataSource andStartWithPhotoAtIndex:(NSUInteger)index {
    self = [super initWithDataSource:dataSource andStartWithPhotoAtIndex:index];
    if (!self) {
        return nil;
    }
	return self;
}


-(void) loadView {
	[super loadView];
	self.statusbarHidden = YES;
    toolbar_.hidden = YES;
}


-(CGRect) frameForPagingScrollView {
	CGRect frame = IS_IPAD ? CGRectMake(13.0f, 45.0f, 640.0f, 442.0f) : CGRectMake(0.0f, 0.0f, 320.0f, 390.0f);
    if (!IS_IPAD){
        frame.origin.x -= PADDING;
        frame.size.width += (2 * PADDING);
    }
	return frame;
}


-(void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
	[_delegate photoViewController:self selectPhotoAtIndex:currentIndex_];
}


@end
